﻿#pragma once

#include "base_type.h"
#ifdef _WIN32
#include <ws2tcpip.h>
#else
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <string.h>
#endif

#include <string>
#include <string_view>

namespace as{
namespace net{
class SocketAddr;



class Address
{
public:
	explicit Address(uint16 port = 0, bool isLocal = false, bool isIpv6 = false);
	Address(std::string_view addr, uint16 port, bool isIpv6 = false);
	~Address();

	sockaddr* GetSockAddr() const;
	int GetAF() const;
	uint16 GetPort() const;
	int GetLen() const;

	std::string GetAddr() const;

	union
	{
		struct sockaddr_in addr_;
		struct sockaddr_in6 addr6_;
	};
};






} 
}

